#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
	int n;
	scanf("%d", &n);

	int m;
	for (int i = 0; i < n; i++) {	
		scanf("%d", &m);
		int radix = 10;
		int power = -1, remaining = 0;
		while (m > 0) {
			++power;
			remaining = m % radix;
			m = (m - remaining) / 10;
			if (remaining >= 5) {
				if (m != 0)
					++m;
			}
		}

		for (int j = 0; j < power; j++)
			remaining *= radix;
		printf("%d\n", remaining);
		
	}
	return 0;
}